package com.apcc4m.sfpush.listener;

import com.apcc4m.sfpush.bean.PushMessage;

import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;

public class SfChannelHandlerContext {

    private ChannelHandlerContext ctx;

    public SfChannelHandlerContext(ChannelHandlerContext ctx){
        this.ctx = ctx;
    }

    public void send(PushMessage msg){
        ctx.channel().writeAndFlush(new TextWebSocketFrame(msg.toString()));
    }

    public void close(){
        ctx.close();
    }

}
